const express = require('express');
const fs = require('fs');
const liuyanban = require('../controller/liuyanban.js');
const { getIpFormChinaz, getIpFormHans } = require('../tool/getIp.js');


// express有提供一个顶级的路由模块。直接使用
const router = express.Router();

router.post('/setData', liuyanban.setData)
router.get('/getData', liuyanban.getData)

// 单独api，用于获取本机ip地址
router.get('/getIp', (req, res) => { getIpFormHans().then(v => { res.send(v); }, e => { res.send(e); }) })

module.exports = router;
